using Core.Cache.Memory;
using Core.Cache.Redis;
using Microsoft.Extensions.DependencyInjection;
using System;
using Xunit;

namespace Core.Cache.Test
{
    public class UnitTest1
    {
        [Fact]
        public void Test1()
        {
            try
            {
                IServiceCollection services = new ServiceCollection();
                services.AddCache();
                IServiceProvider serviceProvider = services.BuildServiceProvider();
                ICacheFactory cacheFactory = serviceProvider.GetRequiredService(typeof(ICacheFactory)) as ICacheFactory;
                ICacheClient cacheClient = cacheFactory.CreateClient(CacheType.MemoryCache);
                cacheClient.StringSet("test", "test");
                string str = cacheClient.StringGet("test");
                Console.WriteLine(str);
            }
            catch (Exception ex )
            {

                var v = ex;
                throw;
            }

        }
    }
}
